﻿using System;
using System.Threading;
using System.Threading.Tasks;

namespace Chapter1_16
{
    public static class Program
    {
        public static void Main(string[] args)
        {
            Parallel.For(0, 10, (i) => {
                Console.WriteLine("For {0}", i); 
                Thread.Sleep(1000);
            });

            int[] numbers = new int[] {1,2,3,4,5,6,7,8,9,10 };

            Parallel.ForEach(numbers, (i) => {
                Console.WriteLine("ForEach {0}", i); 
                Thread.Sleep(1000); 
            });

            Console.WriteLine("Aguardando");
            Console.ReadLine(); 
        }
    }
}

